package hyskidotmateuszatgmail.recepcja.fragments;

import hyskidotmateuszatgmail.recepcja.R;
import hyskidotmateuszatgmail.recepcja.adapter.KlasaStatyczna;

import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.LatLng;

import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.InflateException;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

public class FragmentMapa extends Fragment {

	View view;
    GoogleMap map,googleMap; private LocationManager locationManager;
     SupportMapFragment mMapFragment;
     
	   public View onCreateView(LayoutInflater inflater, ViewGroup container,
                       Bundle savedInstanceState) {
//dodatkowy komentarz
		 //dodatkowy komentarz
		 //dodatkowy komentarz
		 //dodatkowy komentarz
		 //dodatkowy komentarz
		 //dodatkowy komentarz
		 //dodatkowy komentarz
		 //dodatkowy komentarz
		 //dodatkowy komentarz
		 //dodatkowy komentarz
		   
              // View rootView = inflater.inflate(R.layout.fragment_mapa, container, false);
               if (view != null) 
               {
                      ViewGroup parent = (ViewGroup) view.getParent();
                      if (parent != null)
                          parent.removeView(view);
                  }
                  try 
                  {
                      view = inflater.inflate(R.layout.fragment_mapa, container, false);
                  } 
                  catch (InflateException e) 
                  {
                      /* map is already there, just return view as it is */
                  }
                  
                  SupportMapFragment mapFragment = (SupportMapFragment)getFragmentManager().findFragmentById(R.id.map);
                  map = mapFragment.getMap();
                  
                  
             //  map = ((SupportMapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
               map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(52.069354,19.480197), 5));
               return view;
       }
	   
	   private void punkty()
	   {
		   int a=0;
		   if( KlasaStatyczna.pojemnosci(1)==0 )
		   {
			   KlasaStatyczna.
		   }
	   }
	   public void onDestroyView() {
           super.onDestroyView();
         try {
             Fragment fragment = (getFragmentManager().findFragmentById(R.id.map));  
             FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction();
             ft.remove(fragment);
             ft.commit();
         } catch (Exception e) {
             e.printStackTrace();
         }
 }
}

